<template>
  <div class="organizationManage">
    <el-row class="org_main_top">
      <!-- <el-col :span="3">
        &nbsp;
      </el-col> -->
      <el-col :span="17"
              :offset="3"
              style="padding-right:27px;">
        <el-col :span="12"
                align="right">
          <span class="onbusi-style">业务范围</span>
          <el-select v-model="rangevalue"
                     placeholder="请选择单位类型"
                     @change="onBusiness">
            <el-option v-for="item in rangeList"
                       :key="item.value"
                       :label="item.name"
                       :value="item.value"
                       :disabled="item.disabled">
            </el-option>
          </el-select>
        </el-col>
        <el-col :span="12"
                draggable="true"
                v-drag
                align="right">
          <span class="onbusi-style">单位名称</span>
          <el-input v-model="unitName"
                    class="unit-name"
                    placeholder="请输入单位名称"></el-input>
        </el-col>
      </el-col>

      <el-col :span="2"
              align="right">
        <!-- v-drag="getData" -->
        <el-button class="search_button"
                   type="primary"
                   v-drag
                   icon="el-icon-search"
                   @click="searchData()">搜索</el-button>
      </el-col>
      <el-col :span="2"
              align="right">
        <!-- v-drag="getData" -->
        <el-button class="appli-list"
                   type="primary"
                   v-drag
                   @click="onAppliList()">申请列表</el-button>
      </el-col>
    </el-row>
    <el-row class="org_main_mid">
      <el-table ref="unitTable"
                @current-change="handleUnitChange"
                :header-cell-style="{ background: '#f5f5f5' }"
                :data="unitListData"
                @row-click="getRowId"
                height="310"
                :highlight-current-row="true"
                border
                class="org-main-table">
        <el-table-column prop="company_name"
                         align="center"
                         width="170"
                         label="单位名称"
                         show-overflow-tooltip>
        </el-table-column>
        <el-table-column prop="adress"
                         align="center"
                         label="单位地址"
                         show-overflow-tooltip>
        </el-table-column>
        <el-table-column prop="contact_name"
                         width="100"
                         align="center"
                         label="负责人"
                         show-overflow-tooltip>
        </el-table-column>
        <el-table-column prop="contact_phone"
                         align="center"
                         label="联系电话"
                         show-overflow-tooltip>
        </el-table-column>
        <el-table-column prop="create_date"
                         align="center"
                         label="入驻时间"
                         show-overflow-tooltip>
        </el-table-column>
        <el-table-column label="操作"
                         align="center"
                         width="350">
          <template slot-scope="scope">
            <el-button @click="linkToEdit(scope.row)"
                       type="text">
              修改
            </el-button>
            <el-button type="text"
                       @click="(systemDialog = true), openWarrant(scope.row)">
              系统授权
            </el-button>
            <el-button type="text"
                       @click="(businessDialog = true), getRangeList(scope.row)">
              业务范围
            </el-button>
            <el-button type="text"
                       @click="(adminDialog = true), openAdminList(scope.row)">
              分配管理员
            </el-button>
            <el-button type="text"
                       @click="deleteDialogShow(scope.row)">
              删除
            </el-button>
          </template>
        </el-table-column>
      </el-table>
      <!-- 系统授权弹窗 -->
      <el-dialog :visible.sync="systemDialog"
                 title="系统授权"
                 :before-close="handleCloseSystem"
                 :close-on-click-modal="false">
        <el-col :span="24"
                class="system-col"
                align="right"
                style="margin-bottom:20px;">
          <el-input placeholder="请输入系统名称"
                    class="system-name-input"
                    style="width:50%;margin-right:22px;"
                    v-model="searchKey"></el-input>
          <el-button type="primary"
                     icon="el-icon-search"
                     @click="searchSystem()">搜索</el-button>
        </el-col>
        <el-col class="system-dialog">
          <el-table :header-cell-style="{ background: '#f5f5f5' }"
                    :data="warrantTableData"
                    :highlight-current-row="true"
                    border
                    height="290px"
                    @selection-change="selectPower"
                    @select-all="selectAllPower"
                    @row-click="getSystemRow"
                    class="system-table">
            <el-table-column align="center"
                             :selectable="powerlimit"
                             type="selection"
                             width="80">
            </el-table-column>
            <el-table-column prop="system_name"
                             align="center"
                             label="系统名称"
                             show-overflow-tooltip>
            </el-table-column>
            <el-table-column prop="system_no"
                             align="center"
                             label="系统编号"
                             show-overflow-tooltip>
            </el-table-column>
          </el-table>
        </el-col>
        <el-col :span="24"
                class="col_pagination">
          <el-pagination background
                         id="pagination"
                         @current-change="systemCurrentChange"
                         :current-page="systemCurrentPage"
                         :page-sizes="[10]"
                         :page-size="pagesize"
                         style="margin-top:15px;"
                         layout="total, sizes, prev, pager, next, jumper"
                         :total="systemTotal">
          </el-pagination>
        </el-col>
        <div style="text-align:center;">
          <!-- v-show="powerRowData.length<1?false:true" -->
          <el-button style="margin-right:13px;"
                     @click="(systemDialog = false), (searchKey = '')">返 回</el-button>
          <el-button type="primary"
                     @click="sureAddSystem">确 定</el-button>
        </div>
      </el-dialog>
      <!-- 业务范围选择弹窗 -->
      <el-dialog :visible.sync="businessDialog"
                 :before-close="handleCloseBusine"
                 title="业务范围"
                 :close-on-click-modal="false">
        <el-table :header-cell-style="{ background: '#f5f5f5' }"
                  :data="businessTableData"
                  border
                  :highlight-current-row="true"
                  height="290px"
                  @close="dialogClose"
                  @selection-change="selectRow"
                  class="bussis-dialog">
          <el-table-column align="center"
                           :selectable="seleclimit"
                           type="selection"
                           width="80">
          </el-table-column>
          <el-table-column prop="name"
                           align="center"
                           label="业务范围"
                           show-overflow-tooltip>
          </el-table-column>
          <el-table-column prop="content1"
                           align="center"
                           label="业务描述"
                           show-overflow-tooltip>
          </el-table-column>
        </el-table>
        <div style="text-align:center;margin-top:20px;">
          <el-button @click="cancelAddRange"
                     style="margin-right:13px;">返 回</el-button>
          <el-button type="primary"
                     @click="sureAddRange">确 定</el-button>
        </div>
      </el-dialog>
      <!-- 分配管理员弹窗 -->
      <el-dialog :visible.sync="adminDialog"
                 title="分配管理员"
                 v-dialogDrag
                 :before-close="handleCloseAdmin"
                 :close-on-click-modal="false"
                 width="75%">
        <el-row class="assign_main">
          <el-col :span="24"
                  class="assign_top"
                  style="margin-bottom:20px;">
            <el-col :span="7"
                    align="right">
              <span class="word_rule">账号</span>
              <el-input class="input_rule"
                        v-model="account"
                        placeholder="请输入账号"></el-input>
            </el-col>
            <el-col :span="7"
                    align="right">
              <span class="word_rule">姓名</span>
              <el-input class="input_rule"
                        v-model="name"
                        placeholder="请输入姓名"></el-input>
            </el-col>
            <el-col :span="7"
                    align="right">
              <span class="word_rule">手机</span>
              <el-input class="input_rule"
                        v-model="phone"
                        placeholder="请输入手机号"></el-input>
            </el-col>
            <el-col :span="3"
                    align="right">
              <el-button type="primary"
                         icon="el-icon-search"
                         @click="searchAccount">搜索</el-button>
            </el-col>
          </el-col>
          <el-col :span="24"
                  class="assign_table">
            <el-table border
                      :header-cell-style="{ background: '#f5f5f5' }"
                      :highlight-current-row="true"
                      :data="adminListData"
                      height="290px"
                      @selection-change="selectAdmin"
                      @select-all="selectAll"
                      style="width: 100%"
                      class="admin-style">
              <el-table-column type="selection"
                               :selectable="selectable"
                               align="center"
                               width="80">
              </el-table-column>
              <el-table-column label="系统账号"
                               align="center"
                               show-overflow-tooltip>
                <template slot-scope="scope">
                  <el-button type="text"
                             @click="linkToDetail(scope.row)"
                             class="user_num">
                    {{ scope.row.user_no }}
                  </el-button>
                </template>
              </el-table-column>
              <el-table-column prop="user_name"
                               align="center"
                               label="用户姓名">
              </el-table-column>
              <el-table-column prop="status_name"
                               align="center"
                               label="状态"
                               show-overflow-tooltip>
              </el-table-column>
              <el-table-column prop="phone"
                               align="center"
                               label="手机号"
                               show-overflow-tooltip>
              </el-table-column>
              <el-table-column prop="dept_name"
                               align="center"
                               label="所属部门"
                               show-overflow-tooltip>
              </el-table-column>
              <el-table-column prop="create_date"
                               width="155"
                               align="center"
                               label="创建日期"
                               show-overflow-tooltip>
              </el-table-column>
            </el-table>
          </el-col>
          <el-col :span="24"
                  class="comp-and-user">
            <p><span>单位与用户是否有关系</span>
              <el-checkbox v-model="is_rela"
                           true-label="1"
                           false-label="0"
                           @change="onIsReChange"></el-checkbox>
            </p>
          </el-col>
          <el-col :span="24"
                  align="center"
                  class="assign_page">
            <el-pagination id="pagination"
                           background
                           @current-change="adminListCurrentChange"
                           :current-page="adminListCurrentPage"
                           :page-sizes="[10]"
                           :page-size="pagesize"
                           layout="total, sizes, prev, pager, next, jumper"
                           :total="adminListTotal">
            </el-pagination>
          </el-col>
          <el-col :span="24"
                  align="center"
                  style="margin-top:20px;">
            <!-- v-show="selectAdminData.length==1?true:false" -->
            <el-button style="margin-right:13px;"
                       @click="
                (adminDialog = false), (account = ''), (name = ''), (phone = ''),(companyId,''),(is_rela,0)
              ">返回</el-button>
            <el-button type="primary"
                       @click="saveAdminData()">确定</el-button>
          </el-col>
        </el-row>
      </el-dialog>
      <!-- 用户详情弹窗 -->
      <el-dialog :visible.sync="userDeatilDialog"
                 :close-on-click-modal="false"
                 width="80%">
        <div class="accountDetail">
          <el-row class="detail_main">
            <el-form :inline="true"
                     :model="formInline"
                     class="demo-form-inline">
              <el-row>
                <el-col :span="12"
                        align="right"
                        class="detail_top_left">
                  <el-form-item label="账号">
                    <el-input type="text"
                              disabled
                              placeholder="请输入账号"
                              v-model="formInline.user_no"
                              autocomplete="off"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12"
                        class="detail_top_right">
                  <el-form-item label="用户姓名">
                    <el-input type="text"
                              disabled
                              placeholder="请输入用户姓名"
                              v-model="formInline.user_name"
                              autocomplete="off"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12"
                        align="right"
                        class="detail_top_left">
                  <el-form-item label="手机号">
                    <el-input type="text"
                              disabled
                              placeholder="请输入手机号"
                              v-model="formInline.phone"
                              autocomplete="off"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12"
                        class="detail_top_right">
                  <el-form-item label="用户类型">
                    <el-input type="text"
                              disabled
                              placeholder="请输入用户类型"
                              v-model="formInline.user_type_name"
                              autocomplete="off"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12"
                        align="right"
                        class="detail_top_left">
                  <el-form-item label="创建日期">
                    <el-input type="text"
                              disabled
                              placeholder="请输入创建日期"
                              v-model="formInline.create_date"
                              autocomplete="off"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12"
                        class="detail_top_right">
                  <el-form-item label="所属单位">
                    <el-input type="text"
                              disabled
                              placeholder="请输入所属单位"
                              v-model="formInline.dept_name"
                              autocomplete="off"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
            </el-form>
            <el-row class="detail_tabs">
              <el-col :span="24"
                      align="center">
                <el-tabs type="border-card"
                         class="data-tabs">
                  <el-tab-pane label="权限管理">
                    <el-col :span="24"
                            class="tabs_top">
                      <el-col :span="9">
                        <span class="span_bind">权限类型</span>
                        <el-select v-model="detailPowerType"
                                   placeholder="请选择"
                                   @change="getDetailPowerList">
                          <el-option key="0"
                                     label="全部"
                                     value="0"></el-option>
                          <el-option v-for="item in detailPowerList"
                                     :key="item.value"
                                     :label="item.name"
                                     :value="item.value">
                          </el-option>
                        </el-select>
                      </el-col>
                      <el-col :span="9">
                        <span class="span_bind">检索</span>
                        <el-input v-model="detailPowerSearch"
                                  :clearable="true"
                                  @input="getDetailPowerList"
                                  placeholder="支持名称/路径/编号模糊匹配"
                                  class="tabs_input_bind"></el-input>
                      </el-col>
                      <el-col :span="6"
                              class="tabs_select">
                        <el-checkbox-group v-model="detailCheckList">
                          <el-checkbox label="3">独立权限</el-checkbox>
                          <el-checkbox label="2">岗位权限</el-checkbox>
                        </el-checkbox-group>
                      </el-col>
                    </el-col>
                    <el-col :span="24"
                            class="tabs-col">
                      <el-table border
                                :header-cell-style="{ background: '#f5f5f5' }"
                                :data="detailPowerTableData"
                                height="140"
                                class="power-table">
                        <el-table-column prop="object_name"
                                         align="center"
                                         label="权限名称"
                                         show-overflow-tooltip>
                        </el-table-column>
                        <el-table-column prop="assign_name"
                                         align="center"
                                         label="权限类型"
                                         show-overflow-tooltip>
                        </el-table-column>
                        <el-table-column prop="object_no"
                                         align="center"
                                         label="权限编号"
                                         show-overflow-tooltip>
                        </el-table-column>
                        <el-table-column prop="expir_date"
                                         align="center"
                                         label="过期时间"
                                         show-overflow-tooltip>
                        </el-table-column>
                      </el-table>
                    </el-col>
                    <el-col :span="24"
                            align="center">
                      <el-pagination id="pagination"
                                     background
                                     @current-change="detailPowerCurrentChange"
                                     :current-page="detailPowerCurrentPage"
                                     :page-sizes="[10]"
                                     :page-size="pagesize"
                                     layout="total, sizes, prev, pager, next, jumper"
                                     :total="detailPowerTotal">
                      </el-pagination>
                    </el-col>
                  </el-tab-pane>
                  <!-- 授权系统 -->
                  <el-tab-pane label="授权系统">
                    <el-col class="warrant-col">
                      <el-table border
                                :header-cell-style="{ background: '#f5f5f5' }"
                                :data="detailWarrantTableData"
                                height="310"
                                class="warrant-table">
                        <el-table-column prop="system_name"
                                         align="center"
                                         label="系统名称"
                                         show-overflow-tooltip>
                        </el-table-column>
                        <el-table-column prop="system_no"
                                         align="center"
                                         label="系统编号"
                                         show-overflow-tooltip>
                        </el-table-column>
                      </el-table>
                    </el-col>
                    <el-col align="center"
                            class="pagination-col">
                      <el-pagination background
                                     id="pagination"
                                     @current-change="detailWarrantCurrentChange"
                                     :current-page="detailWarrantTablePage"
                                     :page-sizes="[10]"
                                     :page-size="pagesize"
                                     layout="total, sizes, prev, pager, next, jumper"
                                     :total="detailWarrantTotal">
                      </el-pagination>
                    </el-col>
                  </el-tab-pane>
                  <!-- 操作日志 -->
                  <el-tab-pane label="操作日志">
                    <el-col :span="24"
                            class="opeate-col">
                      <el-col :span="20"
                              align="right">
                        <span class="opeate-span">选择时间段</span>
                        <el-date-picker v-model="detailOperateTime"
                                        type="datetimerange"
                                        range-separator="至"
                                        format="yyyy-MM-dd HH:mm:ss"
                                        @change="getDetailOperationLogList"
                                        start-placeholder="开始日期"
                                        end-placeholder="结束日期">
                        </el-date-picker>
                      </el-col>
                      <el-col :span="4"
                              align="right">
                        <el-button icon="el-icon-search"
                                   class="search_btn"
                                   @click="getDetailOperationLogList">搜索</el-button>
                      </el-col>
                    </el-col>
                    <el-col :span="24"
                            class="opeate-table-col">
                      <el-table border
                                height="310"
                                :header-cell-style="{ background: '#f5f5f5' }"
                                :data="detailOperateTableData"
                                class="opeate-table">
                        <el-table-column prop="oper_type_name"
                                         align="center"
                                         label="操作类别"
                                         show-overflow-tooltip>
                        </el-table-column>
                        <el-table-column prop="content"
                                         align="center"
                                         label="操作内容"
                                         show-overflow-tooltip>
                        </el-table-column>
                        <el-table-column prop="oper_date"
                                         align="center"
                                         label="操作时间"
                                         show-overflow-tooltip>
                        </el-table-column>
                      </el-table>
                    </el-col>
                    <el-col :span="24"
                            align="center">
                      <el-pagination background
                                     id="pagination"
                                     @current-change="detailOperateCurrentChange"
                                     :current-page="detailOperatePage"
                                     :page-sizes="[10]"
                                     :page-size="pagesize"
                                     layout="total, sizes, prev, pager, next, jumper"
                                     :total="detailOperateTotal">
                      </el-pagination>
                    </el-col>
                  </el-tab-pane>
                  <!-- 登录日志 -->
                  <el-tab-pane label="登录日志">
                    <el-col :span="24"
                            class="login-col">
                      <el-col :span="20"
                              align="right">
                        <span class="login-span">选择时间段</span>
                        <el-date-picker v-model="detailLoginTime"
                                        type="datetimerange"
                                        range-separator="至"
                                        @change="getDetailLoginLogList"
                                        start-placeholder="开始日期"
                                        end-placeholder="结束日期">
                        </el-date-picker>
                      </el-col>
                      <el-col :span="4"
                              align="right">
                        <el-button icon="el-icon-search"
                                   class="search_btn"
                                   @click="getDetailLoginLogList">搜索</el-button>
                      </el-col>
                    </el-col>
                    <el-col :span="24"
                            class="login-table-col">
                      <el-table border
                                height="310"
                                :header-cell-style="{ background: '#f5f5f5' }"
                                :data="detailLogTableData"
                                class="login-table">
                        <el-table-column prop="oper_type_name"
                                         align="center"
                                         label="操作类别"
                                         show-overflow-tooltip>
                        </el-table-column>
                        <el-table-column prop="oper_ip"
                                         align="center"
                                         label="IP"
                                         show-overflow-tooltip>
                        </el-table-column>
                        <el-table-column prop="oper_date"
                                         align="center"
                                         label="操作时间"
                                         show-overflow-tooltip>
                        </el-table-column>
                      </el-table>
                    </el-col>
                    <el-col :span="24"
                            align="center">
                      <el-pagination background
                                     id="pagination"
                                     @current-change="detailLogCurrentChange"
                                     :current-page="detailLoginLogPage"
                                     :page-sizes="[10]"
                                     :page-size="pagesize"
                                     layout="total, sizes, prev, pager, next, jumper"
                                     :total="detailLoginLogTotal">
                      </el-pagination>
                    </el-col>
                  </el-tab-pane>
                </el-tabs>
              </el-col>
            </el-row>
          </el-row>
        </div>
      </el-dialog>
    </el-row>
    <el-row>
      <el-col :span="24"
              class="col_pagination">
        <el-pagination background
                       id="pagination"
                       @current-change="handleCurrentChange"
                       :current-page="currentPage"
                       :page-sizes="[10]"
                       :page-size="pagesize"
                       layout="total, sizes, prev, pager, next, jumper"
                       :total="total">
        </el-pagination>
      </el-col>
    </el-row>
    <el-row class="add-row">
      <el-col :span="24"
              align="right"
              class="add-col"
              style="margin-top:-20px;">
        <el-button class="add_unit"
                   type="primary"
                   icon="el-icon-plus"
                   v-if="userInfo.user_type === '1' || userInfo.user_type === '2'"
                   @click="addUnit()">
          新增单位
        </el-button>
      </el-col>
      <!-- tabs切换 -->
      <el-col :span="24">
        <el-tabs type="border-card"
                 @tab-click="tabsClick"
                 class="unit_tabs">
          <el-tab-pane label="授权系统">
            <el-table :header-cell-style="{ background: '#f5f5f5' }"
                      :data="systemData"
                      border
                      height="300px"
                      class="adminTable">
              <el-table-column prop="system_name"
                               align="center"
                               label="系统名称"
                               show-overflow-tooltip>
              </el-table-column>
              <el-table-column prop="system_no"
                               align="center"
                               label="系统编号"
                               show-overflow-tooltip>
              </el-table-column>
              <el-table-column label="操作"
                               align="center">
                <template slot-scope="scope">
                  <el-button type="text"
                             @click="openDeleteSystem(scope.row)">
                    删除
                  </el-button>
                </template>
              </el-table-column>
            </el-table>
            <el-col :span="24"
                    align="center">
              <el-pagination background
                             id="pagination"
                             @current-change="authCurrentChange"
                             :current-page="authCurrentPage"
                             :page-sizes="[10]"
                             :page-size="pagesize"
                             layout="total, sizes, prev, pager, next, jumper"
                             :total="authTotal">
              </el-pagination>
            </el-col>
          </el-tab-pane>
          <el-tab-pane label="业务范围">
            <el-table :header-cell-style="{ background: '#f5f5f5' }"
                      :data="rangeTableData"
                      border
                      height="300px"
                      class="adminTable">
              <el-table-column prop="company_type_name"
                               align="center"
                               label="业务类型"
                               show-overflow-tooltip>
              </el-table-column>
              <el-table-column width="150"
                               align="center"
                               label="操作">
                <template slot-scope="scope">
                  <el-button type="text"
                             @click="openDeleteRangeRow(scope.row)">
                    删除
                  </el-button>
                </template>
              </el-table-column>
            </el-table>
            <el-col :span="24"
                    align="center">
              <el-pagination background
                             id="pagination"
                             @current-change="rangeCurrentChange"
                             :current-page="rangeCurrentPage"
                             :page-sizes="[10]"
                             :page-size="pagesize"
                             layout="total, sizes, prev, pager, next, jumper"
                             :total="rangeTotal">
              </el-pagination>
            </el-col>
          </el-tab-pane>
          <el-tab-pane label="管理员账号">
            <el-table :header-cell-style="{ background: '#f5f5f5' }"
                      :data="adminTableData"
                      border
                      height="300px"
                      class="adminTable">
              <el-table-column prop="user_no"
                               align="center"
                               label="账号"
                               show-overflow-tooltip>
              </el-table-column>
              <el-table-column prop="user_name"
                               align="center"
                               label="姓名"
                               show-overflow-tooltip>
              </el-table-column>
              <el-table-column prop="phone"
                               align="center"
                               label="手机"
                               show-overflow-tooltip>
              </el-table-column>
              <el-table-column align="center"
                               prop="mail"
                               label="邮箱"
                               show-overflow-tooltip>
              </el-table-column>
              <el-table-column prop="create_date"
                               align="center"
                               label="创建时间"
                               show-overflow-tooltip>
              </el-table-column>
              <el-table-column width="150"
                               align="center"
                               label="操作">
                <template slot-scope="scope">
                  <el-button type="text"
                             :disabled="scope.row.status == '1' ? false : true"
                             @click="resetPass(scope.row)">
                    重置密码
                  </el-button>
                  <el-button type="text"
                             v-show="scope.row.status == '1' ? true : false"
                             @click="openStatus(scope.row)">
                    停用
                  </el-button>
                  <el-button type="text"
                             v-show="scope.row.status == '2' ? true : false"
                             @click="openStatus(scope.row)">
                    启用
                  </el-button>
                </template>
              </el-table-column>
            </el-table>
            <el-col :span="24"
                    align="center">
              <el-pagination background
                             id="pagination"
                             @current-change="adminCurrentChange"
                             :current-page="adminCurrentPage"
                             :page-sizes="[10]"
                             :page-size="pagesize"
                             layout="total, sizes, prev, pager, next, jumper"
                             :total="adminTotal">
              </el-pagination>
            </el-col>
          </el-tab-pane>
        </el-tabs>
      </el-col>
      <!-- 申请列表 -->
      <el-dialog title="申请列表"
                 width="50%"
                 :before-close="appliListClose"
                 :visible.sync="appliListVisible">
        <el-dialog width="40%"
                   title="授权申请"
                   :before-close="authClose"
                   :visible.sync="appliAuthVisible"
                   append-to-body>
          <AuthAppliDialog :judgeAuthOpen="judgeAuthOpen"
                           :objAuthRow="objAuthRow"
                           :authCallBack="authCallBack">
          </AuthAppliDialog>
        </el-dialog>
        <AppliListDialog :judgeOpen="judgeOpen"
                         :objRow="objRow"
                         :callBack="callBack">
        </AppliListDialog>
      </el-dialog>
    </el-row>
  </div>
</template>
<script>
import AppliListDialog from './Components/AppliListDialog';
import AuthAppliDialog from './Components/AuthAppliDialog';
import { accountDetailApi } from "@/services/SystemManage";
import { unitManageApi } from "@/services/orgainzeManage";
export default {
  components: {
    AppliListDialog,
    AuthAppliDialog
  },
  data () {
    return {
      judgeAuthOpen: 0,//1：打开；0：关闭
      objAuthRow: {},
      judgeOpen: 0,//1：打开申请列表弹框；0：关闭申请列表弹框
      objRow: {},//申请列表对象
      appliAuthVisible: false,
      appliListVisible: false,
      companyId: '',
      is_rela: 0,
      currentRow: null,
      userInfo: {}, //存储session中的用户信息
      user_id: "", //用户id
      unitName: "", //单位名称
      rangevalue: "", //业务范围下拉框选中的值
      currentPage: 1, //单位管理列表分页当前页的值
      total: 0, //单位管理列表分页总条数
      pagesize: 10, //单位管理列表每页的条数限制
      account: "", //账号
      name: "", //姓名
      phone: "", //手机
      deleteUnitName: "", //需要删除的单位名称
      org_id: "", //单位id
      systemCurrentPage: 1, //系统授权列表分页当前页的值
      systemTotal: 0, //系统授权列表分页总条数
      searchKey: "", //系统授权搜索框中的值
      system_org_id: "", //系统授权表格行的单位id
      system_sid: "", //系统授权表格行的系统id
      system_no: "", //系统授权表格行的系统编码
      powerRowData: [], //存储系统授权复选框中勾选的数据
      adminDialog: false, //分配管理员弹窗
      systemDialog: false, //系统授权弹窗
      businessDialog: false, //业务范围的弹窗
      warrantTableData: [], //系统授权弹窗表格数据
      businessTableData: [],
      rangeList: [{ name: "全部", value: "" }],
      unitListData: [], //单位管理列表表格数据
      systemData: [],
      rangeTableData: [], //tabs切换下的业务范围的列表数据表格
      rangeCurrentPage: 1, //tabs切换下的业务范围的分页当前页
      rangeTotal: 0, //tabs切换下的业务范围的分页总条数
      authTotal: 0,
      authCurrentPage: 1,
      selectRowData: [], //存储业务范围复选框中的单位类型value
      adminListData: [], //分配管理员的列表数据
      adminListCurrentPage: 1, //分配管理员的分页当前页
      adminListTotal: 0, //分配管理员下的分页总条数
      selectAdminData: [], //存储分配管理员复选框中勾选的数据
      adminTableData: [], //tabs切换下的分配管理员的列表表格数据
      adminCurrentPage: 1, //tabs切换下的分配管理员下的分页当前页
      adminTotal: 0, //tabs切换下的分配管理员下的分页总条数
      user_name: "", //重置密码的账户名
      reset_id: "", //重置密码的userID
      delete_system_name: "", //tabs切换下的系统授权的的删除项的名称
      delete_comp_system_id: "", //tabs切换下的系统授权的的删除行的id
      delete_company_type_name: "", //tabs切换下的业务范围的删除项的名称
      delete_company_type_id: "", //tabs切换下的业务范围的删除行的id
      //用户详情弹窗属性
      userDeatilDialog: false, //用户详情弹窗初始状态
      uuid: "", //用户id
      formInline: {
        user_no: "",
        user_name: "",
        phone: "",
        user_type_name: "",
        create_date: "",
        dept_name: ""
      },
      detailPowerType: "0",
      detailPowerList: [], //权限管理下权限类型的值
      detailPowerSearch: "", //权限列表搜索关键字
      detailCheckList: ["3"], //权限管理下复选框的值
      detailPowerTableData: [], //权限管理表格数据
      detailPowerCurrentPage: 1, //权限管理表格分页当前页
      detailPowerTotal: 0, //权限管理表格总条数
      detailWarrantTableData: [], //授权系统表格数据
      detailWarrantTablePage: 1, //授权系统表格分页当前页
      detailWarrantTotal: 0, //授权系统表格总条数
      detailOperateTime: [], //操作日志时间
      detailOperateTableData: [], //操作日志的表格数据
      detailOperatePage: 1, //操作日志表格分页当前页
      detailOperateTotal: 0, //操作日志表格总条数
      detailLoginTime: [], //登录日志时间
      detailLogTableData: [], //登录日志的表格数据
      detailLoginLogPage: 1, //登录日志的表格分页当前页
      detailLoginLogTotal: 0, //登陆日志的表格总条数
      opeateState: false
    };
  },
  methods: {
    authCallBack (val) {//授权子组件向父组件传值
      if (val == '重置' || val == '确定') {
        this.judgeAuthOpen = 0;//1：打开；0：关闭
        this.objAuthRow = {}
        this.appliAuthVisible = false;
      }
    },
    authClose (done) {//申请授权关闭前触发的事件
      this.judgeAuthOpen = 0;//1：打开；0：关闭
      this.objAuthRow = {};
      this.appliAuthVisible = false;
      done()
    },
    callBack (row) {//子组件向父组件传值
      this.judgeAuthOpen = 1;//1：打开；0：关闭
      this.objAuthRow = Object.assign({}, row)
      this.$set(this.objAuthRow, 'contact_name', row.contact_name)
      this.appliAuthVisible = true;
      console.log('子->父=', row)
    },
    appliListClose (done) {//申请列表关闭前触发的事件
      this.judgeOpen = 0;
      this.objRow = {};
      done()
    },
    //单位与用户是否有关系
    onIsReChange (val) {
      this.is_rela = val;
      console.log('is_rela=', this.is_rela)
    },
    //背景色
    handleUnitChange (val) {
      this.currentRow = val;
    },
    //设置默认当前被选中且添加背景色
    setCurrent (row) {
      this.$refs.unitTable.setCurrentRow(row);
    },
    //系统授权关闭事件
    handleCloseSystem (done) {
      done();
      this.systemDialog = false;
      this.searchKey = "";
      this.systemCurrentPage = 1;
    },
    //业务范围关闭事件
    handleCloseBusine (done) {
      done();
      this.selectRowData = [];
    },
    //分配管理员关闭事件
    handleCloseAdmin (done) {
      done();
      this.account = "";
      this.name = "";
      this.phone = "";
      this.adminListCurrentPage = 1;
    },
    //业务范围改变触发事件
    onBusiness () {
      this.searchData();
    },
    //跳转到新增单位页面
    addUnit () {
      this.$router.push("/addUnit");
    },
    //跳转到修改单位页面
    linkToEdit (row) {
      this.$router.push({
        path: "/editUnit",
        query: { org_id: row.company_id }
      });
    },
    //跳转到账号详情页面
    linkToDetail (row) {
      this.adminDialog = false;
      this.userDeatilDialog = true;
      this.uuid = row.user_id;
      this.getDetail();
      this.getDetailPowerTypeData();
      this.getDetailPowerList();
      this.getDetailWarrantList();
      this.getDetailOperationLogList();
      this.getDetailLoginLogList();
    },
    //获取业务范围选择下拉框的数据
    getRangeData () {
      unitManageApi.getSelectList({}).then(
        res => {
          this.rangeList = this.rangeList.concat(res.data);
        },
        err => {
          console.log(err);
        }
      );
    },
    //获取单位管理列表数据(表格)
    getTableData () {
      unitManageApi
        .getUnitList({
          params: {
            user_id: this.user_id,
            page_size: 10,
            is_page: 1,
            page: this.currentPage,
            unit_type_id: this.rangevalue,
            unit_name: this.unitName
          }
        })
        .then(
          res => {
            this.unitListData = res.data.list;
            this.total = res.data.total_count;
            if (this.unitListData.length != 0) {
              //数据列表有值的情况下，给第一行默认添加选中的颜色
              this.setCurrent(this.unitListData[0]);
              //获取点击单位管理列表单位id
              this.getRowId(this.unitListData[0]);
            } else {
            }
          },
          err => {
            console.log(err);
          }
        );
    },
    //申请列表
    onAppliList () {
      this.judgeOpen = 1;
      this.objRow = {
        // tableData: this.unitListData,
        user_id: this.user_id,
        // total: this.total,
        // pagesize: this.pagesize
      };
      this.appliListVisible = true;
    },
    //单位列表搜索功能
    searchData () {
      this.currentPage = 1;
      this.getTableData();
      //清空
      this.org_id = "";
      //授权系统清空
      this.systemData = [];
      this.authTotal = 1;
      //业务范围清空
      this.rangeTableData = [];
      this.rangeTotal = 1;
      //管理员帐号清空
      this.adminTableData = [];
      this.adminTotal = 1;
    },
    //单位管理列表分页功能(表格)
    handleCurrentChange (page) {
      this.currentPage = page;
      this.getTableData();
    },
    //弹出删除单位弹窗
    deleteDialogShow (row) {
      this.$confirm("此操作将永久删除, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          this.deleteUnitName = row.company_name;
          this.org_id = row.company_id;
          //删除
          unitManageApi
            .deleteRow({
              data: {
                org_id: this.org_id
              }
            })
            .then(
              res => {
                if (res.msg === "SUCCESS") {
                  this.$message.success("删除成功！");
                  this.getTableData();
                } else {
                }
              },
              err => {
                console.log(err);
              }
            );
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除!"
          });
        });
    },
    //获取系统授权当前行的公司id
    openWarrant (row) {
      this.org_id = row.company_id;
      this.getWarrantData();
    },
    //获取系统授权表格列表数据
    getWarrantData () {
      unitManageApi
        .selectWarrantList({
          params: {
            is_page: 1,
            page: this.systemCurrentPage,
            page_size: 10,
            system_name: this.searchKey,
            company_id: this.org_id
          }
        })
        .then(
          res => {
            this.warrantTableData = res.data.list;
            this.systemTotal = res.data.total_count;
          },
          err => {
            console.log(err);
          }
        );
    },
    //系统授权列表分页功能
    systemCurrentChange (page) {
      this.systemCurrentPage = page;
      this.getWarrantData();
    },
    //系统授权搜索功能
    searchSystem () {
      this.systemCurrentPage = 1;
      this.systemCurrentChange(this.systemCurrentPage);
    },
    //系统授权点击当前行获取id
    getSystemRow (row) {
      this.system_sid = row.sid;
      this.system_no = row.system_no;
    },
    //系统授权表格勾选事件
    selectPower (selection) {
      this.powerRowData.length = 0;
      for (var i = 0; i < selection.length; i++) {
        this.powerRowData.push({
          sid: selection[i].sid,
          system_no: selection[i].system_no
        });
      }
    },
    //系统授权表格勾选限制
    powerlimit (row) {
      if (row.is_select == "1") {
        return false;
      } else {
        if (this.powerRowData.length >= 1) {
          return false;
        } else {
          return true;
        }
      }
    },
    //系统授权表格全选
    selectAllPower () {
      this.powerRowData.length = 0;
      this.getWarrantData();
    },
    //点击系统授权弹窗的确定按钮，添加行数据到tabs中的表格
    sureAddSystem () {
      //console.log('this.powerRowData', this.powerRowData.length);
      if (this.powerRowData.length == 0) {
        this.$message("请先勾选数据!");
      } else {
        unitManageApi
          .addUnitSystem({
            data: {
              org_id: this.org_id,
              sid: this.powerRowData[0].sid,
              system_no: this.powerRowData[0].system_no
            }
          })
          .then(
            res => {
              if (res.msg === "SUCCESS") {
                this.$message.success("添加成功！");
                this.getTabsWarrant();
                this.systemDialog = false;
                this.systemCurrentPage = 1;
                this.powerRowData.length = 0;
              } else {
                this.systemDialog = false;
                this.systemCurrentPage = 1;
              }
            },
            err => {
              console.log(err);
            }
          );
      }
    },
    //获取点击单位管理列表单位id
    getRowId (row) {
      this.org_id = row.company_id;
      //授权系统(点击时就改变)
      this.getTabsWarrant();
      //业务范围(点击时就改变)
      this.getTabsRange();
      //管理员帐号(点击时就改变)
      this.getPointAdminList();
    },
    //获取tabs标签页中的授权系统的表格列表
    getTabsWarrant () {
      unitManageApi
        .getWarrantList({
          params: {
            org_id: this.org_id,
            is_page: 1,
            page: this.authCurrentPage,
            page_size: 10
          }
        })
        .then(
          res => {
            this.systemData = res.data.list;
            this.authTotal = res.data.total_count;
            //console.log('csy', this.systemData)
          },
          err => {
            console.log(err);
          }
        );
    },
    //tabs标签页切换事件
    tabsClick (tab, event) {
      if (tab.index == "0") {
        if (this.org_id != "") {
          this.getTabsWarrant();
        }
      } else if (tab.index == "1") {
        if (this.org_id != "") {
          this.getTabsRange();
        }
      } else if (tab.index == "2") {
        if (this.org_id != "") {
          this.getPointAdminList();
        }
      }
    },
    //tabs标签页下的系统授权表格的分页功能
    authCurrentChange (page) {
      this.authCurrentPage = page;
      this.getTabsWarrant();
    },
    //打开删除tabs标签页下的系统授权表格的弹窗
    openDeleteSystem (row) {
      this.$confirm("此操作将永久删除, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          this.delete_comp_system_id = row.comp_system_id;
          this.delete_system_name = row.system_name;
          unitManageApi
            .deleteSystem({
              data: {
                comp_system_id: this.delete_comp_system_id
              }
            })
            .then(
              res => {
                if (res.msg === "SUCCESS") {
                  this.$message.success("删除成功!");
                  this.getTabsWarrant();
                } else {
                }
              },
              err => {
                console.log(err);
              }
            );
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除!"
          });
        });
    },
    //获取业务范围的弹窗的列表数据
    getRangeList (row) {
      console.log("row=", row);
      unitManageApi
        .selectRange({
          params: {
            org_id: row.company_id
          }
        })
        .then(
          res => {
            //console.log('res000000000000=', res);
            this.businessTableData = res.data;
          },
          err => {
            console.log(err);
          }
        );
    },
    //业务范围的弹窗表格勾选事件
    selectRow (selection) {
      this.selectRowData.length = 0;
      for (var i = 0; i < selection.length; i++) {
        this.selectRowData.push(selection[i].value);
      }
    },
    //业务范围的表格勾选限制
    seleclimit (row) {
      if (row.is_select == 1) {
        return false;
      } else {
        return true;
      }
    },
    //业务范围弹窗的关闭按钮事件
    dialogClose () {
      this.selectRowData.length = 0;
      this.businessDialog = false;
    },
    //业务范围的确认按钮
    sureAddRange () {
      if (this.selectRowData.length == 0) {
        this.$message("请先勾选数据!");
      } else {
        unitManageApi
          .addRange({
            data: {
              org_id: this.org_id,
              company_type: this.selectRowData.join(",")
            }
          })
          .then(
            res => {
              if (res.msg === "SUCCESS") {
                this.selectRowData.length = 0;
                this.businessDialog = false;
                this.$message.success("添加成功！");
                this.getTabsRange();
              }
            },
            err => {
              console.log(err);
            }
          );
      }
    },
    //业务范围的范围按钮
    cancelAddRange () {
      this.dialogClose();
    },
    //获取tabs标签页中的业务范围的表格列表
    getTabsRange () {
      unitManageApi
        .pointRange({
          params: {
            org_id: this.org_id,
            is_page: 1,
            page: this.rangeCurrentPage,
            page_size: 10
          }
        })
        .then(
          res => {
            this.rangeTableData = res.data.list;
            this.rangeTotal = res.data.total_count;
          },
          err => {
            console.log(err);
          }
        );
    },
    //获取tabs标签页中的业务范围的表格分页功能
    rangeCurrentChange (page) {
      this.rangeCurrentPage = page;
      this.getTabsRange();
    },
    //打开tabs标签页中的业务范围的表格删除弹窗
    openDeleteRangeRow (row) {
      this.$confirm("此操作将永久删除, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          this.delete_company_type_name = row.company_type_name;
          this.delete_company_type_id = row.company_type_id;
          unitManageApi
            .deleteRange({
              data: {
                company_type_id: this.delete_company_type_id
              }
            })
            .then(
              res => {
                if (res.msg === "SUCCESS") {
                  this.$message.success("删除成功！");
                  this.getTabsRange();
                }
              },
              err => {
                console.log(err);
              }
            );
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除!"
          });
        });
    },
    //打开分配管理员的弹窗（并获取单位id）
    openAdminList (row) {
      this.is_rela = 0;
      this.companyId = row.company_id;
      this.org_id = row.company_id;
      this.getAdminList();
    },
    //获取分配管理员的弹窗的列表数据
    getAdminList () {
      unitManageApi
        .assignAdmin({
          params: {
            comp_id: this.org_id,
            is_assign: 1,
            is_page: 1,
            page: this.adminListCurrentPage,
            page_size: this.pagesize,
            user_no: this.account,
            user_name: this.name,
            phone: this.phone
          }
        })
        .then(
          res => {
            this.adminListData = res.data.list;
            this.adminListTotal = res.data.total_count;
          },
          err => {
            console.log(err);
          }
        );
    },
    // 分配管理员的弹窗的列表分页
    adminListCurrentChange (page) {
      this.adminListCurrentPage = page;
      this.getAdminList();
    },
    //分配管理员弹窗的搜索功能
    searchAccount () {
      this.adminListCurrentPage = 1;
      this.adminListCurrentChange(this.adminListCurrentPage);
    },
    //分配管理员表格勾选事件
    selectAdmin (selection) {
      this.selectAdminData.length = 0;
      for (var i = 0; i < selection.length; i++) {
        this.selectAdminData.push(selection[i].user_id);
      }
    },
    //分配管理员表格单选限制
    selectable (row, index) {
      if (row.is_select == 1) {
        return false;
      } else {
        if (this.selectAdminData.length >= 1) {
          return false;
        } else {
          return true;
        }
      }
    },
    //分配管理员表格全选勾选事件
    selectAll () {
      this.selectAdminData.length = 0;
      this.getAdminList();
    },
    //点击保存按钮
    saveAdminData () {
      if (this.selectAdminData.length == 0) {
        this.$message("请先勾选数据!");
      } else {
        let objParams = {}//定义对象
        if (this.is_rela == 1) {//单位与用户有关系
          objParams = {
            company_id: this.companyId,
            is_rela: this.is_rela,
            user_id: this.selectAdminData.join(",")
          }
        } else {//单位与用户无关系
          objParams = {
            //  company_id:this.org_id,
            user_id: this.selectAdminData.join(",")
          }
        }
        unitManageApi
          .saveAdmin({
            data: objParams
          })
          .then(
            res => {
              if (res.msg == "SUCCESS") {
                this.$message.success("添加成功！");
                this.companyId = '';
                this.is_rela = 0;
                this.getPointAdminList();
                this.adminDialog = false;
              }
            },
            err => {
              console.log(err);
            }
          );
      }
    },
    //获取指定单位下的管理员列表
    getPointAdminList () {
      unitManageApi
        .pointUnitAdmin({
          params: {
            page: this.adminCurrentPage,
            org_id: this.org_id,
            is_page: 1,
            page_size: 10
          }
        })
        .then(
          res => {
            this.adminTableData = res.data.list;
            this.adminTotal = res.data.total_count;
          },
          err => {
            console.log(err);
          }
        );
    },
    //tabs切换页下的分配管理员的分页功能
    adminCurrentChange (page) {
      this.adminCurrentPage = page;
      this.getPointAdminList();
    },
    //tabs切换页下的分配管理员的停用与启用功能
    openStatus (row) {
      var status = "";
      if (row.status == "1") {
        status = "2";
      } else {
        status = "1";
      }
      this.$confirm("是否更新帐户状态?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          unitManageApi
            .openStatus({
              data: {
                user_id: row.user_id,
                status: status
              }
            })
            .then(
              res => {
                if (res.msg === "SUCCESS") {
                  this.getPointAdminList();
                  if (row.status == "1") {
                    this.$message.error("账号已停用！");
                  } else {
                    this.$message.success("账号已启用！");
                  }
                }
              },
              err => {
                console.log(err);
              }
            );
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消操作!"
          });
        });
    },
    //tabs切换页下的分配管理员的重置密码功能
    resetPass (row) {
      this.$confirm("是否重置帐户密码?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          this.user_name = row.user_no;
          this.reset_id = row.user_id;
          unitManageApi
            .resetPassword({
              data: {
                user_id: this.reset_id,
                reset_status_pwd: "2"
              }
            })
            .then(
              res => {
                if (res.msg === "SUCCESS") {
                  this.getPointAdminList();
                  this.$message.success("密码已重置！");
                }
              },
              err => {
                console.log(err);
              }
            );
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消操作!"
          });
        });
    },
    //用户详情弹窗的函数
    //获取账号详情信息
    getDetail () {
      accountDetailApi
        .getAccDetail({
          params: {
            user_id: this.uuid
          }
        })
        .then(
          res => {
            this.formInline.user_no = res.data.user_no;
            this.formInline.user_name = res.data.user_name;
            this.formInline.phone = res.data.phone;
            this.formInline.user_type_name = res.data.user_type_name;
            this.formInline.create_date = res.data.create_date;
            this.formInline.dept_name = res.data.dept_name;
            this.user_id = res.data.user_id;
          },
          err => {
            console.log(err);
          }
        );
    },
    //获取权限类型
    getDetailPowerTypeData () {
      accountDetailApi
        .getPowerType({
          params: {
            is_page: 0,
            code_type: "object_sort"
          }
        })
        .then(
          res => {
            this.detailPowerList = res.data.list;
          },
          err => {
            console.log(err);
          }
        );
    },
    //获取权限管理列表（表格数据）
    getDetailPowerList () {
      accountDetailApi
        .getPowerMgt({
          params: {
            is_page: 1,
            user_id: this.uuid,
            is_assigns: this.detailCheckList.join(","),
            page: this.detailPowerCurrentPage,
            object_sort: this.detailPowerType,
            search_word: this.detailPowerSearch
          }
        })
        .then(
          res => {
            this.detailPowerTableData = res.data.list;
            this.detailPowerTotal = res.data.total_count;
          },
          err => {
            console.log(err);
          }
        );
    },
    //权限管理分页
    detailPowerCurrentChange (page) {
      this.detailPowerCurrentPage = page;
      this.getDetailPowerList();
    },
    //获取授权系统列表
    getDetailWarrantList () {
      accountDetailApi
        .getDownPowerList({
          params: {
            is_page: 1,
            admin_id: this.uuid,
            page: this.detailWarrantTablePage
          }
        })
        .then(
          res => {
            if (JSON.stringify(res.data) == "{}") {
              this.detailWarrantTableData = [];
            } else {
              this.detailWarrantTableData = res.data.list;
              this.detailWarrantTotal = res.data.total_count;
            }
          },
          err => {
            console.log(err);
          }
        );
    },
    //授权系统分页
    detailWarrantCurrentChange (page) {
      this.detailWarrantTablePage = page;
      this.getDetailWarrantList();
    },
    //获取操作日志列表
    getDetailOperationLogList () {
      accountDetailApi
        .getOperationLog({
          params: {
            is_page: 1,
            user_id: this.uuid,
            page: this.detailOperatePage,
            start_time: this.detailOperateTime[0],
            end_time: this.detailOperateTime[1]
          }
        })
        .then(
          res => {
            if (JSON.stringify(res.data) == "{}") {
              this.detailOperateTableData = [];
            } else {
              this.detailOperateTableData = res.data.list;
              this.detailOperateTotal = res.data.total_count;
            }
          },
          err => {
            console.log(err);
          }
        );
    },
    //操作日志分页
    detailOperateCurrentChange (page) {
      this.detailOperatePage = page;
      this.getDetailOperationLogList();
    },
    //获取登陆日志列表
    getDetailLoginLogList () {
      accountDetailApi
        .getLoginLog({
          params: {
            is_page: 1,
            user_id: this.uuid,
            start_time: this.detailLoginTime[0],
            end_time: this.detailLoginTime[1],
            page: this.detailLoginLogPage
          }
        })
        .then(
          res => {
            if (JSON.stringify(res.data) == "{}") {
              this.detailLogTableData = [];
            } else {
              this.detailLogTableData = res.data.list;
              this.detailLoginLogTotal = res.data.total_count;
            }
          },
          err => {
            console.log(err);
          }
        );
    },
    //登录日志分页
    detailLogCurrentChange (page) {
      this.detailLoginLogPage = page;
      this.getDetailLoginLogList();
    }
  },
  created () {
    this.user_id = window.localStorage.getItem("user_id");
    this.userInfo = JSON.parse(localStorage.getItem("userInfo"));
    this.getRangeData();
    this.getTableData();
  },
  mouted () { }
};
</script>
<style scoped lang="scss">
.comp-and-user {
  span {
    margin-right: 12px;
  }
  margin-bottom: 20px;
}
/deep/ .comp-and-user .el-checkbox__inner {
  border-color: #409eff !important;
}
/deep/ .el-select {
  display: inline-block;
  position: relative;
  width: 76% !important;
}
.onbusi-style {
  padding-right: 12px;
}
.organizationManage {
  background: #fff;
  height: 100%;
  overflow-y: scroll;
}
.org_main_top {
  padding: 20px;
}
.search_button {
  width: calc(100% - 10px);
  margin-right: 10px;
}
.appli-list {
  width: calc(100% - 10px);
}
.org_main_mid {
  padding: 20px;
  padding-top: 0px;
}
.org-main-table {
  width: 100%;
}
.system-dialog {
  margin-bottom: 10px;
}
.system-table {
  width: 100%;
}
.bussis-dialog {
  width: 100%;
}
.word_rule {
  margin-right: 5px;
}
.assign_table {
  margin-bottom: 15px;
}
.unit-name {
  width: 73%;
}
.delete-tips {
  font-size: 16px;
}
.delete-info {
  font-size: 16px;
  color: #1890ff;
}
.assign_top {
  margin-bottom: 15px;
}
.col_pagination {
  padding-bottom: 20px;
  text-align: center;
}
.reset_info {
  font-size: 16px;
}
.reset_tips {
  font-size: 16px;
  color: #1890ff;
}
.add_unit {
  padding: 12px 10px;
}
/deep/ .add_unit span {
  margin-left: 0px;
}
.add-row {
  padding: 20px;
}
.system-col {
  margin-bottom: 10px;
}
.system-name-input {
  width: 30%;
}
.add-col {
  margin-bottom: 20px;
}
.normal_btn {
  background: #1abc9c;
  color: #fff;
}
.input_rule {
  width: 70%;
}
.search_btn {
  // width: 100px;
  background: #1abc9c;
  color: #fff;
}
.user_num {
  text-decoration: underline;
}

.adminTable {
  width: 100%;
  margin-bottom: 15px;
}
/deep/ .unit_tabs .el-tabs__item {
  font-size: 15px;
}
/deep/ .org-main-table .el-table__body tr.current-row > td {
  background: #1890ff;
  color: #fff;
}
/deep/ .org-main-table .el-table__body tr.current-row > td .el-button {
  color: #fff;
}
/deep/ .system-dialog .el-table__body tr.current-row > td {
  background: #1890ff;
  color: #fff;
}
/deep/ .bussis-dialog .el-table__body tr.current-row > td {
  background: #1890ff;
  color: #fff;
}
/deep/ .admin-style .el-table__body tr.current-row > td {
  background: #1890ff;
  color: #fff;
}
//用户详情弹窗样式
.detail_main {
  //padding: 20px;
}
/deep/ .detail_main .el-form-item__content {
  line-height: 40px;
  position: relative;
  font-size: 14px;
  width: 85% !important;
}
/deep/ .detail_main .el-form-item {
  margin-bottom: 22px;
  width: 100%;
}
.detail_top_left {
  padding-right: 50px !important;
}
.detail_top_right {
  padding-left: 50px !important;
}
.detail_tabs {
  //padding: 0 10px;
}

.span_bind {
  font-size: 14px;
}

.tabs_input_bind {
  width: 72%;
}

.tabs_select {
  height: 40px;
  line-height: 40px;
}

.search_btn {
  background: #1abc9c;
  color: #fff;
}

.tabs_top {
  margin-bottom: 10px;
}

.tabs-col {
  margin-bottom: 15px;
}
.power-table {
  width: 100%;
}
.warrant-col {
  margin-bottom: 15px;
}
.warrant-table {
  width: 100%;
}
.pagination-col {
  margin-bottom: 20px;
}
.opeate-col {
  margin-bottom: 15px;
}
.opeate-span {
  font-size: 14px;
}
.opeate-table-col {
  margin-bottom: 15px;
}
.opeate-table {
  width: 100%;
}
.login-col {
  margin-bottom: 15px;
}
.login-span {
  font-size: 14px;
}
.login-table-col {
  margin-bottom: 15px;
}
.login-table {
  width: 100%;
}
</style>
